export default {
    namespaced: true,
    state: {
        routerPaht:{}, // 当前路由路径对象
        routerPahtList:[],  // 路由路径对象列表
    },
    actions: {
    },
    mutations: {
        ADDROUTERPAHT(state, value){ // 添加路由路径对象和更新当前路由路径对象
            state.routerPaht = value
            
            if(value.path === '/home') return
            
            const  data = state.routerPahtList
            for (let i = 0; i < data.length; i++) {
                if(JSON.stringify(data[i]) === JSON.stringify(value)){
                    return
                }
            }
            data.push(value)
        },
        REMOVEROUTERPAHT(state, value){ // 删除路由路径对象列表某个路径对象
            const  data = state.routerPahtList
            for (let i = 0; i < data.length; i++) {
                if(JSON.stringify(data[i]) === JSON.stringify(value)){
                    return data.splice(i, 1)
                }
            }
        },
    },
    getters: {
    }
}